<template>
<<<<<<< HEAD
  <div>
    <div style="height:42px;background-color:#67c23a;font-size:24px;line-height:40px;color:#ffffff">
      以友善的态度对待每一位顾客
    </div>
    <el-drawer
    title="我的"
    :visible.sync="drawer"
    :direction="direction"
    style="width:700px"
    >
    <div>昵称</div>
    <el-input
    v-model="input1">
    </el-input>
    <div>用户名</div>
    <el-input
    v-model="inputt">
    </el-input>
    <div>联系电话</div>
    <el-input
    v-model="input2">
    </el-input>
    <div>年龄</div>
    <el-input
    v-model="input3">
    </el-input>
    <div>账户余额</div>
    <el-input
    v-model="input4">
    </el-input>
  
  </el-drawer>
    <div style="height:42px;background-color:#67c23a;"><el-input
        :data="tabledata.filter(data => !search || data.area1.toLowerCase().includes(search.toLowerCase())||data.area2.toLowerCase().includes(search.toLowerCase()) || data.area3.toLowerCase().includes(search.toLowerCase()) || data.value1.toLowerCase().includes(search.toLowerCase()) || data.type.toLowerCase().includes(search.toLowerCase()) )"
              v-model="search"
              size="medium"
              placeholder="输入关键字搜索"
              style="width:390px;"
            /></div>
    <el-table
    :data="tabledata.filter(data => !search || data.area1.toLowerCase().includes(search.toLowerCase())||data.area2.toLowerCase().includes(search.toLowerCase()) || data.area3.toLowerCase().includes(search.toLowerCase()) || data.value1.toLowerCase().includes(search.toLowerCase()) || data.type.toLowerCase().includes(search.toLowerCase()) )"
    style="width: 414px;background-color:#67c23a41;"
    border=""
    height="592px"
    :header-cell-style="{background:'#67c23a41',color:'#606266'}"
    :row-style="{background:'#eef1f6'}"
  > 
    
      
=======
    <el-table
    :data="tabledata.filter(data => !search || data.area1.toLowerCase().includes(search.toLowerCase())||data.area2.toLowerCase().includes(search.toLowerCase()) || data.area3.toLowerCase().includes(search.toLowerCase()) || data.value1.toLowerCase().includes(search.toLowerCase()) || data.type.toLowerCase().includes(search.toLowerCase()) )"
    style="width: 414px;"
    border=""
    height="634px"
    :header-cell-style="{background:'#eeeeee',color:'#606266'}"
    :row-style="{background:'#eef1f6'}"
  >
>>>>>>> b1cd95d47b3903925076cec3bba8675efd049f1e
    
    <el-table-column
      label="订单类型"
      prop="type"
      fixed
      width="50px"
    >
      </el-table-column>
    <el-table-column
      label="收货日期"
      prop="date"
      
      width="100px"
    >
      </el-table-column>
      <el-table-column
        label="省"
        prop="area1"
        width="70px"
      >
        </el-table-column>
        <el-table-column
        label="市"
        prop="area2"
        width="70px"
      >
        </el-table-column>
        <el-table-column
        label="区"
        prop="area3"
        width="70px"
      >
        </el-table-column>
        <el-table-column
        label="金额"
        prop="money"
        
        width="60px"
      >
        </el-table-column>
        <el-table-column
        label="货物类型"
        prop="type1"
        width="100px"
      >
        </el-table-column>
         <el-table-column
        label="预估重量"
        prop="type2"
        width="100px"
      >
        </el-table-column>
        <el-table-column 
        align="right"
        width="70px"
        fixed="right"
        >
          <template
            slot="header"
            slot-scope="scope"
          >
<<<<<<< HEAD
            更多>>
=======
            <el-input
              v-model="search"
              size="mini"
              
              placeholder="输入关键字搜索"
            />
>>>>>>> b1cd95d47b3903925076cec3bba8675efd049f1e
</template>
  <template slot-scope="scope">
    
    
  
  </el-popover>
    <a href="http://localhost:8081/#/order"><el-button
      size="mini"
      type="success"
      style="width:55px"
      @click="handleDelete(scope.$index, scope.row)"
    >接单</el-button></a>
  </template>
  
  </el-table-column>
<<<<<<< HEAD
  
  </el-table>
  <el-button-group>
    <el-button @click="chuan1" type="success" style="float:right;width:206px;height:60px;font-size:30px">
  我的账户
  </el-button>
  <el-button @click="back" type="success" style="float:left;width:206px;height:60px;font-size:30px">返回首页</el-button>
  </el-button-group>
  </div>
=======
  </el-table>
  
>>>>>>> b1cd95d47b3903925076cec3bba8675efd049f1e
</template>
<script>
export default {
  data() {
    return {
<<<<<<< HEAD
      drawer: false,
        direction: 'ltr',
=======
>>>>>>> b1cd95d47b3903925076cec3bba8675efd049f1e
      pickerOptions0: {
    disabledDate(time) {
      return time.getTime() < Date.now()- 8.64e7;
    }
  },
      uid: 1,
      id: 1,
      list: [],
      tabledata: [],
      input: 0,
<<<<<<< HEAD
      input1:'',
      input2:'',
      input3:'',
      input4:'',
      search: "",
      inputt:'',
      alist:[],
=======
      search: "",
      
>>>>>>> b1cd95d47b3903925076cec3bba8675efd049f1e
      dialogFormVisible: false,
      selectedOptions: [],
      options: regionDataPlus,
      address: '',
      
        form: {
          provinces:"",
          city:"",
          area:"",
          type: '',
          type1: '',
          value1: '',
          value2: '',
          value3: '',
          value4: '',
          value5: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: '',
          
        },
        formLabelWidth: '120px',
        pickerOptions: {
          disabledDate(time) {
            return time.getTime() > Date.now();
        
        }
        },
        
    }
  },
  created() {
    this.query();
<<<<<<< HEAD
    this.gettabledata();
    this.test();
=======
    this.gettabledata()
>>>>>>> b1cd95d47b3903925076cec3bba8675efd049f1e
    
  },
  
      

  methods: {
<<<<<<< HEAD
    back(){
      this.$router.go(-1);
    },
=======
>>>>>>> b1cd95d47b3903925076cec3bba8675efd049f1e
    handleEdit(index, row) {
      console.log(index, row);
    },
    handleChange() {
     
      this.form.provinces= CodeToText[this.selectedOptions[0]]
      this.form.city= CodeToText[this.selectedOptions[1]]
      this.form.area= CodeToText[this.selectedOptions[2]]
      
    }, 
    //下单方法
    handleDelete(index, row) {
      // console.log(index, row);
      console.log(row.type);
      this.axios({
        method: "post",
        url: 'http://localhost:3000/received',
        data: {
          type: row.type,
          type1: row.type1,
          type2: row.type2,
          area1: row.area1,
          area2: row.area2,
          area3: row.area3,
          date: row.date,
          money:row.money,
          value1:row.value1,
          id:row.id
        }
      }).then(res => {
         this.axios
        .delete("http://localhost:3000/dingdan/" + row.id)
        .then((response) => {
          
        });
        this.query();
      });
    },
    
    jiage1(){
        this.$data.input=10
      },
    jiage2(){
        this.$data.input=20
      },
    
 edit(item){//省市回显      
     this.selectedOptions.push(TextToCode[this.form.provinces].code,TextToCode[this.form.provinces][this.form.city].code)
  }, 
    query() {
      this.axios.get("http://localhost:3000/users").then((response) => {
        this.list = response.data;
<<<<<<< HEAD
        
=======
>>>>>>> b1cd95d47b3903925076cec3bba8675efd049f1e
      });
    },
    gettabledata() {
      this.axios.get("http://localhost:3000/dingdan").then((a) => {
        this.tabledata = a.data;
        console.log(a)
      });
    },
<<<<<<< HEAD
    test(){
      this.newList =  this.$route.query.qaq; //获取id
      
      console.log("jiedan"+this.newList)
      
      
    },
    chuan1(){
        console.log("zhuye" + this.newList)
        this.$router.push({path : "/mine",query:{ qaq : this.newList}})//传
    },
=======
    
>>>>>>> b1cd95d47b3903925076cec3bba8675efd049f1e
    xiadan(){
      let add = this.form
      this.axios({
        method: "post",
        url: 'http://localhost:3000/dingdan',
        data: {
          type: this.form.type,
          type1: this.form.type1,
          type2: this.form.type2,
          area1: this.form.provinces,
          area2: this.form.city,
          area3: this.form.area,
          date: this.form.value2,
          money: this.input,
          value1: this.form.value1,
        }
      }).then(res => {
     console.log(res.data)
          alert("下单成功")
          this.gettabledata()
      })
    }
  },
};
import { 
  provinceAndCityData, 
  regionData, 
  provinceAndCityDataPlus, 
  regionDataPlus, 
  CodeToText, 
  TextToCode 
  } from 'element-china-area-data'
</script>

